﻿<!-- #Include File="../Include/Admin_Onlogin.asp" -->
<%
strFileName = "Admin_ShowPurview.asp"
Call Main
Call CloseConn()

Sub Main()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Sql = "Select * From [Admin_Auth] Order By sort Asc,AuthID Asc"
		Call Exe_Conn(Rs,Sql,1)
		i = 0
		If Rs.BOF And Rs.EOF Then
			data = ""
		Else
			totalPut = Rs.RecordCount
			Do While Not Rs.Eof
				If i=0 Then
					data = data & "{""id"":"&Rs("AuthID")&",""title"":"""&ToUnicode(Rs("title"))&""",""purview"":"""&ShowPurview(Rs("AuthID"))&""",""pid"":"&Rs("pid")&"}"
				Else
					data = data & ",{""id"":"&Rs("AuthID")&",""title"":"""&ToUnicode(Rs("title"))&""",""purview"":"""&ShowPurview(Rs("AuthID"))&""",""pid"":"&Rs("pid")&"}"
				End If
				Rs.MoveNext
				i=i+1
			Loop
			Rs.Close
		End If
		If totalPut = 0 Then
			Response.Write "{""code"":201,""msg"":""\u65e0\u6570\u636e""}" & vbCrLf
		Else
			Response.Write "{""code"":0,""msg"":""\u83b7\u53d6\u6210\u529f!"",""count"":"&totalPut&",""data"":["&data&"],""rel"":1}" & vbCrLf
		End If
		Response.End()
	Else
		Response.Write "<!DOCTYPE html>" & vbCrLf
		Response.Write "<head>" & vbCrLf
		Response.Write "<title>查看管理权限</title>" & vbCrlf
		Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
		Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
		Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
		Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
		Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
		Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
		Response.Write "<script type='text/javascript'>" & vbCrLf
		Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
		Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
		Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
		Response.Write "</head>" & vbCrlf
		Response.Write "<body>" & vbCrlf
		Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
		Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
		Response.Write "        <legend>查看管理权限</legend>" & vbCrlf
		Response.Write "    </fieldset>" & vbCrlf
		Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrlf
		Response.Write "        <a class=""layui-btn layui-btn-normal layui-btn-sm""  onclick=""openAll();"">" & vbCrlf
		Response.Write "            <i class=""fa fa-folder-open-o""></i> 展开或折叠全部" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "    </blockquote>" & vbCrlf
		Response.Write "    <table class=""layui-table"" id=""treeTable"" lay-filter=""treeTable""></table>" & vbCrlf
		Response.Write "</div>" & vbCrlf
		Response.Write "<script>" & vbCrlf
		Response.Write "    var editObj=null,ptable=null,treeGrid=null,tableId='treeTable',layer=null;" & vbCrlf
		Response.Write "    layui.config({" & vbCrlf
		Response.Write "        base: pc_file + admin_file + '/Plugins/layui/extend/'" & vbCrlf
		Response.Write "    }).extend({" & vbCrlf
		Response.Write "        treeGrid:'treeGrid'" & vbCrlf
		Response.Write "    }).use(['jquery','treeGrid','layer','form'], function(){" & vbCrlf
		Response.Write "        var $=layui.jquery;" & vbCrlf
		Response.Write "        treeGrid = layui.treeGrid;" & vbCrlf
		Response.Write "        layer=layui.layer;" & vbCrlf
		Response.Write "		form = layui.form;" & vbCrlf
		Response.Write "        ptable=treeGrid.render({" & vbCrlf
		Response.Write "            id:tableId" & vbCrlf
		Response.Write "            ,elem: '#'+tableId" & vbCrlf
		Response.Write "            ,idField:'id'" & vbCrlf
		Response.Write "            ,url:'?Action=Main'" & vbCrlf
		Response.Write "            ,method: 'post'" & vbCrLf
		Response.Write "            ,cellMinWidth: 100" & vbCrlf
		Response.Write "            ,treeId:'id'//树形id字段名称" & vbCrlf
		Response.Write "            ,treeUpId:'pid'//树形父id字段名称" & vbCrlf
		Response.Write "            ,treeShowName:'title'//以树形式显示的字段" & vbCrlf
		Response.Write "            ,height:'full-140'" & vbCrlf
		Response.Write "            ,isFilter:false" & vbCrlf
		Response.Write "            ,iconOpen:true//是否显示图标【默认显示】" & vbCrlf
		Response.Write "            ,isOpenDefault:true//节点默认是展开还是折叠【默认展开】" & vbCrlf
		Response.Write "            ,cols: [[" & vbCrlf
		Response.Write "                {field: 'id', title: '编号', width: 70, fixed: true}," & vbCrLf
		Response.Write "                {field: 'title', title: '权限名称', width: 200}," & vbCrLf
		Response.Write "                {field: 'purview', title: '权限管理', width: 360}," & vbCrLf
		Response.Write "            ]]" & vbCrlf
		Response.Write "            ,page:false" & vbCrlf
		Response.Write "        });" & vbCrlf
		Response.Write "    });" & vbCrlf
		Response.Write "    function openAll() {" & vbCrlf
		Response.Write "        var treedata=treeGrid.getDataTreeList(tableId);" & vbCrlf
		Response.Write "        treeGrid.treeOpenAll(tableId,!treedata[0][treeGrid.config.cols.isOpen]);" & vbCrlf
		Response.Write "    }" & vbCrlf
		Response.Write "</script>" & vbCrlf
		Response.Write "</body>" & vbCrLf & "</html>"
	End If
End Sub

Function ShowPurview(strPurview)
    If instr(","&AdminPurview_Group&",",","&strPurview&",")<=0 Then
        ShowPurview = "<i class='icon icon-cross red'></i>"
    Else
        ShowPurview = "<i class='icon icon-checkmark green'></i>"
    End If
End Function
%>
